home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / listx / mlist4.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-17  |  9.0 KB  |  278 lines

  1. VERSION 4.00
  2. Begin VB.MDIForm MDIForm1 
  3.    BackColor       =   &H8000000C&
  4.    Caption         =   "Mabry Software"
  5.    ClientHeight    =   6795
  6.    ClientLeft      =   2145
  7.    ClientTop       =   3195
  8.    ClientWidth     =   9480
  9.    Height          =   7200
  10.    Icon            =   "mlist4.frx":0000
  11.    Left            =   2085
  12.    LinkTopic       =   "MDIForm1"
  13.    Top             =   2850
  14.    Width           =   9600
  15.    Begin VB.PictureBox Title 
  16.       Align           =   1  'Align Top
  17.       BorderStyle     =   0  'None
  18.       Height          =   525
  19.       Left            =   0
  20.       ScaleHeight     =   525
  21.       ScaleWidth      =   9480
  22.       TabIndex        =   0
  23.       Top             =   0
  24.       Width           =   9480
  25.       Begin VB.Label Label1 
  26.          Alignment       =   2  'Center
  27.          Caption         =   "List/X+ Sample Program"
  28.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  29.             Name            =   "MS Sans Serif"
  30.             Size            =   18
  31.             Charset         =   0
  32.             Weight          =   400
  33.             Underline       =   0   'False
  34.             Italic          =   0   'False
  35.             Strikethrough   =   0   'False
  36.          EndProperty
  37.          Height          =   465
  38.          Left            =   1560
  39.          TabIndex        =   1
  40.          Top             =   30
  41.          Width           =   7935
  42.       End
  43.    End
  44.    Begin VB.PictureBox ButtonBar 
  45.       Align           =   3  'Align Left
  46.       BorderStyle     =   0  'None
  47.       Height          =   6270
  48.       Left            =   0
  49.       ScaleHeight     =   6270
  50.       ScaleWidth      =   1515
  51.       TabIndex        =   2
  52.       Top             =   525
  53.       Width           =   1515
  54.       Begin VB.PictureBox Buttons 
  55.          BorderStyle     =   0  'None
  56.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  57.             Name            =   "MS Sans Serif"
  58.             Size            =   13.5
  59.             Charset         =   0
  60.             Weight          =   400
  61.             Underline       =   0   'False
  62.             Italic          =   0   'False
  63.             Strikethrough   =   0   'False
  64.          EndProperty
  65.          Height          =   555
  66.          Index           =   4
  67.          Left            =   0
  68.          ScaleHeight     =   555
  69.          ScaleWidth      =   1575
  70.          TabIndex        =   7
  71.          Top             =   2490
  72.          Width           =   1575
  73.       End
  74.       Begin VB.PictureBox Buttons 
  75.          BorderStyle     =   0  'None
  76.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  77.             Name            =   "MS Sans Serif"
  78.             Size            =   13.5
  79.             Charset         =   0
  80.             Weight          =   400
  81.             Underline       =   0   'False
  82.             Italic          =   0   'False
  83.             Strikethrough   =   0   'False
  84.          EndProperty
  85.          Height          =   555
  86.          Index           =   3
  87.          Left            =   0
  88.          ScaleHeight     =   555
  89.          ScaleWidth      =   1575
  90.          TabIndex        =   6
  91.          Top             =   2280
  92.          Width           =   1575
  93.       End
  94.       Begin VB.PictureBox Buttons 
  95.          BorderStyle     =   0  'None
  96.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  97.             Name            =   "MS Sans Serif"
  98.             Size            =   13.5
  99.             Charset         =   0
  100.             Weight          =   400
  101.             Underline       =   0   'False
  102.             Italic          =   0   'False
  103.             Strikethrough   =   0   'False
  104.          EndProperty
  105.          Height          =   555
  106.          Index           =   2
  107.          Left            =   0
  108.          ScaleHeight     =   555
  109.          ScaleWidth      =   1575
  110.          TabIndex        =   5
  111.          Top             =   1335
  112.          Width           =   1575
  113.       End
  114.       Begin VB.PictureBox Buttons 
  115.          BorderStyle     =   0  'None
  116.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  117.             Name            =   "MS Sans Serif"
  118.             Size            =   13.5
  119.             Charset         =   0
  120.             Weight          =   400
  121.             Underline       =   0   'False
  122.             Italic          =   0   'False
  123.             Strikethrough   =   0   'False
  124.          EndProperty
  125.          Height          =   555
  126.          Index           =   1
  127.          Left            =   0
  128.          ScaleHeight     =   555
  129.          ScaleWidth      =   1575
  130.          TabIndex        =   4
  131.          Top             =   765
  132.          Width           =   1575
  133.       End
  134.       Begin VB.PictureBox Buttons 
  135.          BorderStyle     =   0  'None
  136.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  137.             Name            =   "MS Sans Serif"
  138.             Size            =   13.5
  139.             Charset         =   0
  140.             Weight          =   400
  141.             Underline       =   0   'False
  142.             Italic          =   0   'False
  143.             Strikethrough   =   0   'False
  144.          EndProperty
  145.          Height          =   555
  146.          Index           =   0
  147.          Left            =   0
  148.          ScaleHeight     =   555
  149.          ScaleWidth      =   1575
  150.          TabIndex        =   3
  151.          Top             =   240
  152.          Width           =   1575
  153.       End
  154.    End
  155. Attribute VB_Name = "MDIForm1"
  156. Attribute VB_Creatable = False
  157. Attribute VB_Exposed = False
  158. Option Explicit
  159. Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
  160. Private Declare Function ReleaseCapture Lib "user32" () As Long
  161. Private m_hascapture As Integer
  162. Private m_mousedown As Boolean
  163. Private m_selectedform As Integer
  164. Private Sub LoadForm(f As Form)
  165.    f.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
  166. '   f.WindowState = 2
  167.    f.Show
  168.    f.ZOrder 0
  169. End Sub
  170. Private Sub Buttons_Click(Index As Integer)
  171.    Dim i As Integer
  172.    m_hascapture = -1
  173.    If (Index = m_selectedform) Then
  174.       Exit Sub
  175.    End If
  176.    If (m_selectedform <> -1) Then
  177.       i = m_selectedform
  178.       m_selectedform = -1
  179.       Buttons(i).Refresh
  180.    End If
  181.    m_selectedform = Index
  182.    Select Case (Index)
  183.       Case 0
  184.          LoadForm frmOwnDraw
  185.       Case 1
  186.          LoadForm frmColumns
  187.       Case 2
  188.          LoadForm frmThreedFX
  189.       Case 3
  190.          LoadForm frmColors
  191.       Case 4
  192.          LoadForm frmSort
  193.    End Select
  194. End Sub
  195. Private Sub Buttons_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  196.    m_mousedown = True
  197.    Buttons(Index).Refresh
  198. End Sub
  199. Private Sub Buttons_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  200.    If (m_hascapture <> Index) Then
  201.       Call SetCapture(Buttons(Index).hwnd)
  202.       m_hascapture = Index
  203.       Buttons(Index).Refresh
  204.    Else
  205.       If (x < 0 Or y < 0 Or x > Buttons(Index).ScaleWidth Or y > Buttons(Index).ScaleHeight) Then
  206.          Call ReleaseCapture
  207.          m_hascapture = -1
  208.          Buttons(Index).Refresh
  209.       End If
  210.    End If
  211. End Sub
  212. Private Sub Buttons_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  213.    m_mousedown = False
  214.    Buttons(Index).Refresh
  215. End Sub
  216. Private Sub Buttons_Paint(Index As Integer)
  217.    Dim s As String
  218.    Dim factive As Boolean
  219.    If (Index = m_hascapture) Then
  220.       factive = True And Not m_mousedown
  221.    Else
  222.       factive = False
  223.    End If
  224.    Select Case Index
  225.       Case 0
  226.          s = "Draw!"
  227.       Case 1
  228.          s = "Columns"
  229.       Case 2
  230.          s = "3D Effects"
  231.       Case 3
  232.          s = "Colors"
  233.       Case 4
  234.          s = "Sorting"
  235.    End Select
  236.    If (Index = m_selectedform) Then
  237.       Buttons(Index).ForeColor = RGB(0, 0, 255)
  238.    Else
  239.       Buttons(Index).ForeColor = RGB(0, 0, 128)
  240.    End If
  241.    Buttons(Index).CurrentX = (Buttons(Index).ScaleWidth - Buttons(Index).TextWidth(s)) / 2
  242.    Buttons(Index).CurrentY = (Buttons(Index).ScaleHeight - Buttons(Index).TextHeight(s)) / 2
  243.    Buttons(Index).Print s
  244.    If (factive) Then
  245.       Draw3DRect Buttons(Index), 0, 0, Buttons(Index).Width, Buttons(Index).height, Not factive
  246.    End If
  247. End Sub
  248. Private Sub MDIForm_Load()
  249.    Dim i As Integer
  250.       
  251.    If (Screen.Width > MDIForm1.Width) Then
  252.       MDIForm1.Left = (Screen.Width - MDIForm1.Width) / 2
  253.    Else
  254.       MDIForm1.Left = 0
  255.    End If
  256.    If (Screen.height > MDIForm1.height) Then
  257.       MDIForm1.Top = (Screen.height - MDIForm1.height) / 5
  258.    Else
  259.       MDIForm1.Top = 0
  260.    End If
  261.    Buttons(0).Top = 0
  262.    Buttons(0).Left = 0
  263.    Buttons(0).Width = ButtonBar.Width
  264.    For i = 1 To 4
  265.       Buttons(i).Top = Buttons(i - 1).Top + Buttons(i - 1).height
  266.       Buttons(i).Left = 0
  267.       Buttons(i).Width = ButtonBar.Width
  268.       Buttons(i).height = Buttons(i - 1).height
  269.    Next
  270.    m_hascapture = -1
  271.    m_selectedform = -1
  272.    Me.Show
  273.    DoEvents
  274.    Buttons_Click 0
  275.    Buttons_Paint 0
  276.    Buttons(0).SetFocus
  277. End Sub
  278.